package com.cat.dataStructure02;

import java.util.TreeMap;

class ExamTracker {
    TreeMap<Integer, Long> map = new TreeMap<>();
    long sum;
    public ExamTracker() {
    }
    
    public void record(int time, int score) {
        sum += score;
        map.put(time, sum);
    }
    
    public long totalScore(int startTime, int endTime) {
        System.out.println(map.ceilingKey(1));
        return map.ceilingKey(endTime) - map.ceilingKey(startTime);

    }
}

/**
 * Your ExamTracker object will be instantiated and called as such:
 * ExamTracker obj = new ExamTracker();
 * obj.record(time,score);
 * long param_2 = obj.totalScore(startTime,endTime);
 */